package com.awaken.content.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Swagger API文档配置类
 * 只有当 awaken.features.swagger.enabled=true 时才生效
 *
 * @author awaken-lin
 */
@Slf4j
@Configuration
@ConditionalOnProperty(
    prefix = "awaken.features.swagger",
    name = "enabled",
    havingValue = "true",
    matchIfMissing = false
)
public class SwaggerConfig {

    public SwaggerConfig() {
        log.info("✅ Swagger API文档功能已启用并装配完成");
    }

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("觉醒派内容学习平台 API")
                        .version("1.0")
                        .description("觉醒派内容学习平台接口文档"));
    }
}
